const PROMISE = Symbol('$promise')

class Fetcher {
	constructor() {
		this[PROMISE] = new Promise((resolve, reject) => {
			this.resolve = resolve
			this.reject = reject
		})
	}

	/**
	 * 获取RequestTask对象
	 */
	async source() {
		return this[PROMISE]
	}

	/**
	 * 中断请求
	 */
	async abort() {
		(await this.source())?.abort()
	}
}

export default Fetcher;